package cn.itzhao.massage.service.impl;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

@Service
public class ConsumerMessageListener implements MessageListener {

	private static final Logger logger = LoggerFactory
			.getLogger(ConsumerMessageListener.class);

	protected String info;

	public void onMessage(Message message) {
		TextMessage textMessage = (TextMessage) message;
		try {
			String text = textMessage.getText();
			info = text;
		} catch (JMSException e) {
			logger.info("JMS获取消息内容异常", e);
		}
		System.out.println("接受消息==================" + textMessage);
	}
}
